def add(a: list, b: str, c: list):
    return [str(i + j) + b for i in a for j in c]


def wrap(func, a, b, *args):
    print(a, b, args, sep='\n')
    # a=(i for i in args)
    from functools import reduce
    k = reduce(lambda r, i: r + i, args, 'S')
    m = func(a, k, b)
    print(m)


class Loop(object):

    def __init__(self, a, b, c=10):
        self.p1 = a
        self.p2 = b
        self.p3 = c
        self.p4 = 22
        self.p5 = 33

    def f1(self):
        print('f1')

    def f2(self, i):
        print('f2' + str(i))

    def f3(self, j):
        print('f3' + str(j) + self.p3)

    def f4(self, k):
        print('f4' + str(k))
        return str(k) + '====SSSS'


class Runn(Loop):

    def __init__(self, a, b, c, gg):
        super(Runn, self).__init__(a, b, c=c)
        self.gg = gg

    def __setattr__(self, key, value):
        print("setting ... ", str(key), str(value))

        super().__setattr__(key, value)
        # self.__dict__[key]=value

    def __getattr__(self, item):
        print("getattr.....")

        return "not found"

    def __getattribute__(self, item):
        print("getAttribute..")
        return super().__getattribute__(item)

    def pub(self):
        print(super().__dict__)


if __name__ == '__main__':

    # wrap(add,[2,3,4],[7,3,2],'ds','op')
    # print('sss'+str(3))
    print(dir(Loop))
    k = Loop(2, 3)
    print(dir(k))
    for i in range(10):
        if hasattr(k, 'p' + str(i)):
            setattr(k, 'p' + str(i), i * 10)

    k.sss = 'hihihi'
    print(k.__dict__)

    runn = Runn(3, 3, 4, 10)
    # print(runn)
    print('------------<>>', runn.__dict__)
    # runn.pub()

    a = runn.uu
    print('a --? ', a is None, a)
    b = runn.gg
    print('b... ', b)
    print("------->>>>")
    print('---->',runn.__dict__)
    print("------->>>>")
    print(dir(runn), len(dir(runn)), sep='\n')
    import time

    time.sleep(4)
    print("ok")
